from django.apps import AppConfig
import os


class AppConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'App'

    def ready(self):
        # 避免开发环境中Django自动重载时重复启动线程
        if os.environ.get('RUN_MAIN') == 'true':
            from .tasks import start_scheduler
            start_scheduler()
